<template>
  <div class="app-container">
    <!-- 基础信息 -->
    <h5 class="titleInfo">银行卡基础信息</h5>
    <el-form ref="forms" class="form" label-width="130px">
      <el-row>
        <el-col :span="12">
          <el-form-item label="医院名称" prop="realName">{{params.targetName}}</el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="银行卡类型" prop="username" v-if="params.type==0">对公账户</el-form-item>
          <el-form-item label="银行卡类型" prop="username" v-if="params.type==1">对私账户</el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="姓名" prop="username">{{params.bankAccountName}}</el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="银行卡号码" prop="username">{{params.bankCard}}</el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="手机号码" prop="username">{{params.mobileId}}</el-form-item>
        </el-col>
      </el-row>
      <div class="divBar" />
      <h5 class="titleInfo">附件信息</h5>
      <el-row>
        <el-col :span="24">
          <el-form-item label="委托书及其附件">
            <a
              v-for="(item, index) in params.proxyFiles"
              :key="index"
              :href="`https://mmkappnew.oss-cn-beijing.aliyuncs.com/`+item"
              target="_blank"
              rel="noopener noreferrer"
            >附件—{{index+1}}</a>
          </el-form-item>
        </el-col>
      </el-row>
      <el-col :span="24">
        <el-form-item>
          <el-button
            style="margin-top:30px"
            type="primary"
            @click="dialogVisible = true"
            v-if="$route.query.type == 1"
          >审核</el-button>
        </el-form-item>
      </el-col>
    </el-form>

    <el-dialog title="提示" :visible.sync="dialogVisible" width="30%">
      <el-form :inline="true" label-width="80px" label-position="right">
        <el-col :span="24">
          <el-form-item label="审核状态">
            <el-select v-model="params.auditStatus" placeholder="请选择">
              <el-option label="审核通过" value="1"></el-option>
              <el-option label="审核驳回" value="2"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="备注">
            <el-input v-model="params.remark" type="textarea" :rows="4" placeholder="请输入内容" />
          </el-form-item>
        </el-col>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="sure">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import checkbrank from "@/api/checkbrank";
export default {
  data() {
    return {
      dialogVisible: false,
      params: {
        cardId: "",
        auditStatus: "",
        remark: "",
        imgSrc: localStorage.getItem("imgUrlPrefix"),
      },
    };
  },
  mounted() {
    this.params.cardId = this.$route.query.id;
    this.detail();
  },
  methods: {
    sure() {
      checkbrank.audit(this.params).then((res) => {
        this.$message.warning(res.data.msg);
        if (res.data.code == 0) {
          this.$router.go(-1);
        }
      });
    },
    detail() {
      checkbrank
        .getMerchantBankcard({ id: this.$route.query.id })
        .then((res) => {
          console.log(res);
          if (res.data.code == 0) {
            this.params = res.data.data;
            this.params.bankAccount = this.params.bankCard;
          } else {
            this.$message.warning(res.data.msg ? res.data.msg : "请求失败");
            //  this.$message.warning('请求失败');
          }
        });
    },
  },
};
</script>
<style scoped>
.app-container {
  padding: 0px !important;
}
a {
  color: blue;
  padding: 0 12px;
  text-decoration-line: underline;
}
</style>